$(()=>{
    let $get = $("#get");
    let $inputbox = $("#inputbox");
    $inputbox.focus();
    let $main = $("#main");
    let $table = $("#table");
    let $item1 = $("#item1");
    let $item2 = $("#item2");
    let $item3 = $("#item3");
    $inputbox.keydown(e=>{if (e.keyCode===13)$get.click();});
    $(document).keydown(e=>{if(e.keyCode===36){if (e.ctrlKey){if(confirm("是否要返回上一页？")){location.href = "./?/index";}}else{if(confirm("是否要返回首页？")){history.back();}}}else if(e.keyCode===45){$inputbox.focus();}});
    $get.click(()=>{
        $main.addClass("el-loading");
        let qq = $inputbox.val();
        $.post("#",{
            qq:qq
        },text=>{
            $main.removeClass("el-loading");
            $table.hide();
            $table.removeClass("el-loading");
            let data=JSON.parse(text);
            if(data.code==200){
                let today=data.data.todaycount;
                let total=data.data.totalcount;
                $item1.text(qq);
                $item2.text(today);
                $item3.text(total);
                $table.fadeIn();
            }else{
                alert(data.msg);
            }
            /* console.log(text); */
        });
    });
});
